<template>
    <div>
        <Button v-if="showBackBtn" class="goBack" type="primary" @click="$router.back()">
            <Icon type="ios-arrow-back"/>
            返回
        </Button>
        <Form ref="formCustom" :model="formCustom" :rules="ruleCustom" :label-width="140">
            <h3>项目基本情况</h3>
            <Card class="line-style">
                <div class="line-wrap">
                    <div class="line-main">
                        <Row>
                            <Col span="7">
                                <Form-item label="项目名称" prop="xmmc">
                                    <i-input type="text" v-model="formCustom.xmmc" placeholder="请输入项目名称"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="预算金额" prop="ysje">
                                    <i-input type="number" number v-model="formCustom.ysje"
                                             placeholder="请输入预算金额"><span slot="append">万元</span></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="拦标价金额" prop="lbjjr">
                                    <!--                                    <Tooltip placement='top-start' content="按照财政指标文或财务预算报表填写">-->
                                    <i-input type="number" number v-model="formCustom.lbjjr"
                                             placeholder="请输入拦标价金额"><span slot="append">万元</span></i-input>
                                    <!--                                    </Tooltip>-->
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="实际投资额" prop="sjtze">
                                    <!--                                    <Tooltip placement='top-start' content="按照财政指标文或财务预算报表填写">-->
                                    <i-input type="number" number v-model="formCustom.sjtze"
                                             placeholder="请输入实际投资额"><span slot="append">万元</span></i-input>
                                    <!--                                    </Tooltip>-->
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="预算下达年度" prop="ysxdnd">
                                    <DatePicker @on-change="ysxdndDateChange" :value="formCustom.ysxdnd"
                                                format="yyyy"
                                                type="year" placeholder="请选择预算下达年度"></DatePicker>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="使用单位/部门" prop="sydw">
                                    <!--                                    <Select style="width:100%" v-model="formCustom.sydw" placeholder="请选择使用单位/部门">-->
                                    <!--                                        <Option value="item.value"></Option>-->
                                    <!--                                    </Select>-->
                                    <!--                                    <Cascader :data="unitList" v-model="formCustom.sydw" change-on-select-->
                                    <!--                                              placeholder="请选择使用单位/部门"></Cascader>-->
                                    <i-input type="text" v-model="formCustom.sydw" placeholder="请选择使用单位/部门"></i-input>
                                </Form-item>
                            </Col>
                            <!--                            <Col span="7">-->
                            <!--                                <Form-item label="上报日期" prop="sbrq">-->
                            <!--                                    <DatePicker @on-change="dateChange" :options="options1" :value="formCustom.sbrq"-->
                            <!--                                                format="yyyy-MM-dd"-->
                            <!--                                                type="date" placeholder="请选择上报日期"></DatePicker>-->
                            <!--                                </Form-item>-->
                            <!--                            </Col>-->
                            <Col span="7">
                                <Form-item label="招标情况" prop="zb_type">
                                    <RadioGroup v-model="formCustom.zb_type" type="button" @on-change="clearValidate">
                                        <Radio label="1">招标</Radio>
                                        <Radio label="0">未招标</Radio>
                                    </RadioGroup>
                                </Form-item>
                            </Col>
                            <Col span="20">
                                <Form-item label="项目类型" prop="xm_type">
                                    <CheckboxGroup v-model="formCustom.xm_type">
                                        <Checkbox style="margin-bottom: 8px" :label="item.codemc" border :key="item.id"
                                                  v-for="item in xm_type_list"></Checkbox>
                                    </CheckboxGroup>
                                </Form-item>
                            </Col>
                            <Col span="22">
                                <Form-item label="运维内容" prop="ywnrjs" style="width:100%">
                                    <!--                                    <Tooltip placement='top-start' content="简单说明运维内容">-->
                                    <i-input :rows="4" type="textarea" v-model="formCustom.ywnrjs"
                                             placeholder="运维内容简单概述：（100字以内）"/>
                                    <!--                                    </Tooltip>-->
                                </Form-item>
                            </Col>
                        </Row>
                    </div>
                </div>
            </Card>

            <h3 v-if="formCustom.zb_type==='0'">未招标</h3>
            <Card class="line-style" v-if="formCustom.zb_type==='0'">
                <div class="line-wrap">
                    <div class="line-main">
                        <Row>
                            <Col span="7">
                                <Form-item label="招标单位/采购单位" prop="wzb_info.zbdwcgdw"
                                           :rules="[{ required: true, message: '请填写招标单位/采购单位', trigger: 'blur' }]">
                                    <!--                                    <Tooltip placement='top-start' content="合同编号">-->
                                    <i-input type="text" v-model="formCustom.wzb_info.zbdwcgdw"
                                             placeholder="请输入招标单位/采购单位"></i-input>
                                    <!--                                    </Tooltip>-->
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="中标金额" prop="wzb_info.zbje"
                                           :rules="[{ required: true,type:'number', message: '请填写中标金额', trigger: 'blur' },{ validator: validateFloat, trigger: 'blur' }]">
                                    <i-input type="number" number v-model="formCustom.wzb_info.zbje"
                                             placeholder="请输入中标金额"><span slot="append">万元</span></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="中标单位名称" prop="wzb_info.zbdwmc"
                                           :rules="[{ required: true, message: '请输入中标单位名称', trigger: 'blur' }]">
                                    <i-input type="text" v-model="formCustom.wzb_info.zbdwmc"
                                             placeholder="请输入中标单位名称"></i-input>
                                    <!--                                    <Cascader :data="unitList" v-model="formCustom.wzb_info.zbdwmc"  change-on-select placeholder="请选择中标单位名称"></Cascader>-->
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="甲方法人" prop="wzb_info.jffr">
                                    <i-input type="text" v-model="formCustom.wzb_info.jffr"
                                             @on-blur="formCustom.wzb_info.jffr?null:formCustom.wzb_info.jffr='无'"
                                             placeholder="请输入甲方法人"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="甲方经办人" prop="wzb_info.jfjbr">
                                    <i-input type="text" v-model="formCustom.wzb_info.jfjbr"
                                             @on-blur="formCustom.wzb_info.jfjbr?null:formCustom.wzb_info.jfjbr='无'"
                                             placeholder="请输入甲方法人"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="甲方经办人电话" prop="wzb_info.jfjbrdh">
                                    <i-input type="text" v-model="formCustom.wzb_info.jfjbrdh"
                                             @on-blur="formCustom.wzb_info.jfjbrdh?null:formCustom.wzb_info.jfjbrdh='无'"
                                             placeholder="请输入甲方经办人手机号"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="乙方法人" prop="wzb_info.yffr">
                                    <i-input type="text" v-model="formCustom.wzb_info.yffr"
                                             @on-blur="formCustom.wzb_info.yffr?null:formCustom.wzb_info.yffr='无'"
                                             placeholder="请输入甲方法人"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="乙方经办人" prop="wzb_info.yfjbr">
                                    <i-input type="text" v-model="formCustom.wzb_info.yfjbr"
                                             @on-blur="formCustom.wzb_info.yfjbr?null:formCustom.wzb_info.yfjbr='无'"
                                             placeholder="请输入甲方法人"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="乙方经办人电话" prop="wzb_info.yfjbrdh">
                                    <i-input type="text" v-model="formCustom.wzb_info.yfjbrdh"
                                             @on-blur="formCustom.wzb_info.yfjbrdh?null:formCustom.wzb_info.yfjbrdh='无'"
                                             placeholder="请输入甲方法人"></i-input>
                                </Form-item>
                            </Col>
                            <Col span="7">
                                <Form-item label="合同签订日期" prop="wzb_info.htqdrq"
                                           :rules="[{ required: true, message: '请填写合同签订日期', trigger: 'blur' }]">
                                    <DatePicker type="month" placeholder="请选择合同签订日期" placement="bottom-end"
                                                @on-change="(date)=>formCustom.wzb_info.htqdrq=date"
                                                :value="formCustom.wzb_info.htqdrq"
                                                format="yyyy-MM" style="width: 100%"></DatePicker>
                                </Form-item>
                            </Col>
                        </Row>
                    </div>
                </div>
            </Card>
            <h3 v-if="formCustom.zb_type==='1'">招标</h3>
            <Card class="line-style" v-if="formCustom.zb_type==='1'">
                <div class="line-wrap">
                    <div class="line-main">
                        <Row>
                            <Col span="7">
                                <Form-item label="招标项目编号" prop="zb_info.zbxmbh"
                                           :rules="[{ required: true, message: '请填写招标项目编号', trigger: 'blur' }]">
                                    <!--                                    <Tooltip placement='top-start' content="合同编号">-->
                                    <i-input type="text" v-model="formCustom.zb_info.zbxmbh"
                                             placeholder="请输入招标项目编号"></i-input>
                                    <!--                                    </Tooltip>-->
                                </Form-item>
                            </Col>
                        </Row>
                        <Row class="bag_group_piece" v-for="(item,index) in formCustom.zb_info.bag_group_list"
                             :key="index">
                            <Row>
                                <Col span="7">
                                    <Form-item label="包组名称" :prop="`zb_info.bag_group_list[${index}].bzmc`"
                                               :rules="[{ required: true, message: '请填写包组名称', trigger: 'blur' }]">
                                        <i-input type="text" v-model="item.bzmc"
                                                 placeholder="请输入包组名称"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="中标金额" :prop="`zb_info.bag_group_list[${index}].zbje`"
                                               :rules="[{ required: true,type:'number', message: '请填写中标金额', trigger: 'blur' },{ validator: validateFloat, trigger: 'blur' }]">
                                        <i-input type="number" number v-model="item.zbje"
                                                 placeholder="请输入中标金额"><span slot="append">万元</span></i-input>
                                    </Form-item>
                                </Col>
<!--                                <Col span="7">-->
<!--                                    <Form-item label="招标金额" :prop="`zb_info.bag_group_list[${index}].zhbje`"-->
<!--                                               :rules="[{ required: true,type:'number', message: '请填写招标金额', trigger: 'blur' },{ validator: validateFloat, trigger: 'blur' }]">-->
<!--                                        &lt;!&ndash;                                    <Tooltip placement='top-start' content="招标金额即拦标价金额">&ndash;&gt;-->
<!--                                        <i-input type="number" number v-model="item.zhbje"-->
<!--                                                 placeholder="请输入招标金额"><span slot="append">万元</span></i-input>-->
<!--                                        &lt;!&ndash;                                    </Tooltip>&ndash;&gt;-->
<!--                                    </Form-item>-->
<!--                                </Col>-->
                                <Col span="7">
                                    <Form-item label="招标单位/采购单位" :prop="`zb_info.bag_group_list[${index}].zbdwcgdw`"
                                               :rules="[{ required: true, message: '请填写招标单位/采购单位', trigger: 'blur' }]">
                                        <!--                                    <Tooltip placement='top-start' content="合同编号">-->
                                        <i-input type="text" v-model="item.zbdwcgdw"
                                                 placeholder="请输入招标单位/采购单位"></i-input>
                                        <!--                                    </Tooltip>-->
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <!--                                <Form-item label="中标单位名称" :prop="`zb_info.bag_group_list[${index}].zbdwmc`" :rules="[{ required: true,type:'array', message: '请选择中标单位名称', trigger: 'change' }]">-->
                                    <!--                                    <Cascader :data="unitList" v-model="item.zbdwmc"  change-on-select placeholder="请选择中标单位名称"></Cascader>-->
                                    <!--                                </Form-item>-->
                                    <Form-item label="中标单位名称" :prop="`zb_info.bag_group_list[${index}].zbdwmc`"
                                               :rules="[{ required: true, message: '请输入中标单位名称', trigger: 'blur' }]">
                                        <i-input type="text" v-model="item.zbdwmc"
                                                 placeholder="请输入中标单位名称"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="甲方法人" :prop="`zb_info.bag_group_list[${index}].jffr`">
                                        <i-input type="text" v-model="item.jffr" @on-blur="item.jffr?null:item.jffr='无'"
                                                 placeholder="请输入甲方法人"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="甲方经办人" :prop="`zb_info.bag_group_list[${index}].jfjbr`">
                                        <i-input type="text" v-model="item.jfjbr"
                                                 @on-blur="item.jfjbr?null:item.jfjbr='无'"
                                                 placeholder="请输入甲方法人"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="甲方经办人电话" :prop="`zb_info.bag_group_list[${index}].jfjbrdh`">
                                        <i-input type="text" v-model="item.jfjbrdh"
                                                 @on-blur="item.jfjbrdh?null:item.jfjbrdh='无'"
                                                 placeholder="请输入甲方经办人手机号"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="乙方法人" :prop="`zb_info.bag_group_list[${index}].yffr`">
                                        <i-input type="text" v-model="item.yffr" @on-blur="item.yffr?null:item.yffr='无'"
                                                 placeholder="请输入乙方法人"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="乙方经办人" :prop="`zb_info.bag_group_list[${index}].yfjbr`">
                                        <i-input type="text" v-model="item.yfjbr"
                                                 @on-blur="item.yfjbr?null:item.yfjbr='无'"
                                                 placeholder="请输入乙方经办人"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="乙方经办人电话" :prop="`zb_info.bag_group_list[${index}].yfjbrdh`">
                                        <i-input type="text" v-model="item.yfjbrdh"
                                                 @on-blur="item.yfjbrdh?null:item.yfjbrdh='无'"
                                                 placeholder="请输入乙方经办人电话"></i-input>
                                    </Form-item>
                                </Col>
                                <Col span="7">
                                    <Form-item label="合同签订日期" :prop="`zb_info.bag_group_list[${index}].htqdrq`"
                                               :rules="[{ required: true, message: '请填写合同签订日期', trigger: 'blur' }]">
                                        <DatePicker type="month" placeholder="请选择合同签订日期" placement="bottom-end"
                                                    @on-change="(date)=>item.htqdrq=date" :value="item.htqdrq"
                                                    format="yyyy-MM" style="width: 100%"></DatePicker>
                                    </Form-item>
                                </Col>
                            </Row>
                            <Row justify="center" type="flex">
                                <Col  v-if="!showDetail">
                                    <Button type="success" @click="addLine()">添加包组</Button>&nbsp;&nbsp;
                                    <Button type="error" @click="delLine(index)">删除包组</Button>
                                </Col>
                            </Row>
                            <!--                            <Col span="4" v-if="!showDetail">-->
                            <!--                                <Button type="success" @click="addLine()">添加包组</Button>&nbsp;&nbsp;-->
                            <!--                                <Button type="error" @click="delLine(index)">删除包组</Button>-->
                            <!--                            </Col>-->
                        </Row>
                    </div>
                </div>
            </Card>
        </Form>
        <Row justify="center" type="flex" style="margin-top: 10px" v-if="!showDetail">
            <Col>
                <Button type="primary" @click="validateForm('formCustom')">保存</Button>
            </Col>
        </Row>
        <Modal
                v-model="modal"
                title="确认操作"
                width="20"
                @on-ok="handleSubmit"
        >
            <div style="text-align:center">
                <p>是否确认保存!</p>
            </div>
        </Modal>

    </div>
</template>

<script>
import {
  insert, getById, getDictionary, jwCodeList
} from '@/api/outbreak-management/government-Informationization-project/operation-and-maintenance-project'

export default {
  data () {
    const validateFloat = (rule, value, callback) => {
      if (!value) callback()
      const reg = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/
      if (!reg.test(value)) {
        callback(new Error('最多只允许两位小数'))
      } else {
        callback()
      }
    }
    return {
      validateFloat: (rule, value, callback) => {
        if (!value) callback()
        const reg = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/
        if (!reg.test(value)) {
          callback(new Error('最多只允许两位小数'))
        } else {
          callback()
        }
      },
      options1: { // 不可选今天之后的日期
        disabledDate (date) {
          return date && date.valueOf() > Date.now()
        }
      },
      isFirst: false,
      xm_type_list: [],
      unitList: [],
      // 弹窗控制
      modal: false,
      // 控制保存按钮显隐
      showDetail: false,
      // 控制返回按钮显隐
      showBackBtn: false,
      formCustom: {
        xmmc: '', // 项目名称
        ywnrjs: '', // 运维内容
        xm_type: [], // 项目类型
        ysje: '', // 预算金额
        lbjjr: '', // 拦标价金额
        ysxdnd: '', // 预算下达年度
        sjtze: '', // 实际投资额
        // sydw: [], // 使用单位/部门
        sydw: '', // 使用单位/部门
        zb_type: '1', // 是否招标 1 招标  0 未招标   招标情况
        wzb_info: {
          zbje: '',
          zbdwcgdw: '',
          zbdwmc: '',
          jffr: '无',
          jfjbr: '无',
          jfjbrdh: '无',
          yffr: '无',
          yfjbr: '无',
          yfjbrdh: '无',
          htqdrq: ''
        },
        zb_info: {
          zbxmbh: '',
          bag_group_list: [{
            zbdwcgdw: '',
            bzmc: '',
            zbje: '',
            zhbje: '',
            zbdwmc: '',
            jffr: '无',
            jfjbr: '无',
            jfjbrdh: '无',
            yffr: '无',
            yfjbr: '无',
            yfjbrdh: '无',
            htqdrq: ''
          }]
        },
        sbrq: ''
      },
      ruleCustom: {
        xmmc: { required: true, message: '项目名称必填', trigger: 'blur' },
        sbrq: { required: true, message: '上报日期必选', trigger: 'blur' },
        ywnrjs: { required: true, message: '运维内容必填', trigger: 'blur' }, // 运维内容
        xm_type: { required: true, type: 'array', message: '项目类型必选', trigger: 'change' }, // 项目类型
        ysje: [{ required: true, type: 'number', message: '预算金额必填', trigger: 'blur' }, {
          validator: validateFloat,
          trigger: 'blur'
        }], // 预算金额
        sjtze: [{ required: true, type: 'number', message: '实际投资额必填', trigger: 'blur' }, {
          validator: validateFloat,
          trigger: 'blur'
        }], // 预算金额
        lbjjr: [{ validator: validateFloat, trigger: 'blur' }], // 预算金额
        ysxdnd: { required: true, message: '预算下达年度必选', trigger: 'change' }, // 预算下达年度
        // sydw: { required: true, type: 'array', message: '使用单位/部门必选', trigger: 'change' }, // 使用单位/部门
        sydw: { required: true, message: '使用单位/部门必选', trigger: 'blur' }, // 使用单位/部门
        zb_type: { required: true, message: '是否招标必选', trigger: 'change' } // 是否招标 1 招标  0 未招标   招标情况
      }
    }
  },
  methods: {
    addLine () {
      this.formCustom.zb_info.bag_group_list.push(
        {
          zbdwcgdw: '',
          bzmc: '',
          zbje: '',
          zhbje: '',
          zbdwmc: '',
          jffr: '无',
          jfjbr: '无',
          jfjbrdh: '无',
          yffr: '无',
          yfjbr: '无',
          yfjbrdh: '无',
          htqdrq: ''
        })
    },
    delLine (index) {
      let len = this.formCustom.zb_info.bag_group_list.length
      if (len === 1) {
        this.$Message.warning('只有一条数据不允许删除!')
        return
      }

      console.log(this.$refs.formCustom)
      this.formCustom.zb_info.bag_group_list.splice(index, 1)
      this.clearValidate()
    },
    clearValidate () {
      this.$nextTick(() => {
        let formData = JSON.stringify(this.formCustom)
        this.$refs.formCustom.resetFields()
        this.formCustom = JSON.parse(formData)
      })
    },
    validateForm (name) {
      this.$refs[name].validate((valid) => {
        if (valid) {
          this.modal = true
        } else {
          this.$Message.error('表单验证失败,请检查后再试!')
        }
      })
    },

    /**
       * 日期格式化
       */
    ysxdndDateChange (date) {
      this.formCustom.ysxdnd = date
    },
    /**
       * 日期格式化
       */
    dateChange (date) {
      this.formCustom.sbrq = date
    },
    /**
       * 日期格式化
       */
    startChange (date) {
      this.formCustom.start_time = date
    },
    handleSubmit () {
      let requestData = { ...this.formCustom }
      if (requestData.zb_type === '1') {
        delete requestData.wzb_info
        requestData.zb_info = JSON.stringify(requestData.zb_info)
      } else {
        delete requestData.zb_info
        requestData.wzb_info = JSON.stringify(requestData.wzb_info)
      }
      requestData.xm_type = JSON.stringify(requestData.xm_type)
      // requestData.sydw = JSON.stringify(requestData.sydw)
      if (requestData.id) {
        requestData.type = '0'
      }
      insert(requestData).then(({ data }) => {
        let { errcode } = data
        if (errcode === 0) {
          this.$Message.success('保存成功!')
        } else {
          this.$Message.error('保存失败!')
        }
      })
    },
    isEditStatus () {
      if (this.$route.query && this.$route.query.id) {
        if (this.$route.query.showDetail) {
          this.showDetail = true
        }
        this.showBackBtn = true
        this.getEditData(this.$route.query.id)
      }
    },
    getEditData (id) {
      getById({ id }).then(({ data }) => {
        let { errcode, data: res } = data
        if (errcode === 0) {
          this.formCustom = res
          // this.formCustom.sbrq = this.$common.moment(res.sbrq).format('YYYY-MM-DD')
          this.formCustom.xm_type = JSON.parse(res.xm_type)
          // this.formCustom.sydw = JSON.parse(res.sydw)
          this.formCustom.lbjjr = Number(res.lbjjr)
          this.formCustom.ysje = Number(res.ysje)
          this.formCustom.sjtze = Number(res.sjtze)
          if (res.zb_type === '1') {
            this.formCustom.zb_info = JSON.parse(res.zb_info)
            this.formCustom.wzb_info = {
              zbje: '',
              zbdwcgdw: '',
              zbdwmc: '',
              jffr: '无',
              jfjbr: '无',
              jfjbrdh: '无',
              yffr: '无',
              yfjbr: '无',
              yfjbrdh: '无',
              htqdrq: ''
            }
          } else {
            this.formCustom.wzb_info = JSON.parse(res.wzb_info)
            this.formCustom.zb_info = {
              zbxmbh: '',
              bag_group_list: [{
                zbdwcgdw: '',
                bzmc: '',
                zbje: '',
                zhbje: '',
                zbdwmc: '',
                jffr: '无',
                jfjbr: '无',
                jfjbrdh: '无',
                yffr: '无',
                yfjbr: '无',
                yfjbrdh: '无',
                htqdrq: ''
              }]
            }
          }
        }
        console.log(data)
      })
    },
    initData () {
      Promise.all([getDictionary('xm_type'), jwCodeList()]).then(res => {
        this.xm_type_list = res[0].data.data
        // let unitList = res[1].data.data
        // let array = []
        // unitList.forEach((item) => {
        //   if (item.yjpid === '0') {
        //     array.push({ value: item.yidw, label: item.yidw, id: item.yjpid })
        //   } else {
        //     jwCodeList({ yjpid: item.yjpid }).then(({ data }) => {
        //       array.push({ value: item.yidw, label: item.yidw, id: item.yjpid, children: data.data, loading: false })
        //     })
        //   }
        // })
        // this.unitList = array
      })
    }
  },
  created () {
    this.initData()
    this.isEditStatus()
  },
  mounted () {
  }
}
</script>

<style scoped>
    h3 {
        margin: 10px auto;
    }

    .bag_group_piece {
        padding: 10px 0;
        margin-bottom: 10px;
        border: 1px solid #dcdee2;
    }
</style>
